<%@ page contentType="text/html; charset=UTF-8" language="java"%>
<%@ page import="com.hzqy.commons.utils.ConstantUtils" %>
<%@ page import="com.hzqy.web.vo.PmsUserVo"%>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>节目增加</title>
    <link rel="stylesheet" type="text/css"	href="static/js/themes/defalut.css">
    <link rel="stylesheet" type="text/css"	href="static/js/themes/public.css">
    <link rel="stylesheet" type="text/css"	href="static/js/themes/ddspstyle.css">
    <link rel="stylesheet" type="text/css"	href="static/js/themes/default/easyui.css">
    <link rel="stylesheet" type="text/css"	href="static/js/themes/icon.css">
    <link rel="stylesheet" type="text/css"	href="static/js/WdatePicker/skin/WdatePicker.css">
    <script type="text/javascript" src="static/js/jquery.min.js"></script>
    <script type="text/javascript" src="static/js/jquery.easyui.min.js"></script>
    <script type="text/javascript" src="static/js/jquery.md5.js"></script>
    <script type="text/javascript"	src="static/js/locale/easyui-lang-zh_CN.js"></script>
    <script type="text/javascript" src="static/js/jquery.validate.js"></script>
    <script type="text/javascript" src="static/js/index.js"></script>

    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">
    <script type="text/javascript">
        function checkMobile(phone){
            if(!(/^1[3|4|5|8|7][0-9]\d{4,8}$/.test(phone))||phone.length!=11){
                return false;
            } else{
                return true;
            }
        }

        function _submitFm() {
            $("#f_pu_name_tip").html("");
            $("#f_pu_phone_tip").html("");
            $("#f_pu_pwd_tip").html("");
            if ($.trim($("#f_pu_name").val()).length == 0) {
                $("#f_pu_name_tip").html("请输入用户名").show();
                $("#f_pu_name").focus();
                return false;
            }else if ($.trim($("#f_pu_pwd").val()).length < 6 || $.trim($("#f_pu_pwd").val()).length >16) {
                $("#f_pu_pwd_tip").html("密码不正确").show();
                $("#f_pu_pwd").focus();
                return false;
            }else if (document.getElementById("f_pu_phone").length < 11) {
                $("#f_pu_phone_tip").html("请输入正确的手机号").show();
                $("#f_pu_phone").focus();
                return false;
            }else if (!checkMobile(document.getElementById("f_pu_phone").value)) {
                $("#f_pu_phone_tip").html("请输入正确的手机号").show();
                $("#f_pu_phone").focus();
                return false;
            }
            //先查看用户的密码输入是否正确
            $.ajax({
                url : "pms/bindUserPhone.do",
                data : {
                    f_pu_name: $('#f_pu_name').val(),
                    f_pu_pwd: $.md5($("#f_pu_pwd").val()),
                    f_pu_phone:$('#f_pu_phone').val()
                },
                dataType : 'json',
                type : 'post',
                success : function(json) {
                    if(json.status==="error"){
                       // $("#f_pu_phone_tip").html(json.msg+" 绑定失败").show();
                        window.alert(json.msg+" 绑定失败");
                    }else{
                        //$("#f_pu_phone_tip").html(json.msg).show();
                        parent.$('#dlg').dialog('close');
                        setTimeout(function () {
                            window.alert(json.msg);
                        },800);
                    }
                }
            });
        }
    </script>
    <style type="text/css">
    </style>
</head>

<body class="overfwidth">
<div class="barnavtop"></div>
<div id="workspace">
    <!--主体 开始-->
    <div id="container-1">
        <div class="editspace">
            <form id="contentForm" class="cmxform" enctype="multipart/form-data" name="formName">
                <legend style="text-align: center; margin: 0 auto;">绑定手机号</legend>
                <fieldset>
                    <div class="fitem">
                        <table width="100%" border="0" cellpadding="0" cellspacing="0">
                            <tr>
                                <td width="20%" align="right">
                                    用户名:
                                </td>
                                <td width="30%">
                                    <input id="f_pu_name" name="f_pu_name" style="width: 150px;" value="" class="yl_inp yw_name" />
                                    <span id="f_pu_name_tip" class="tip red"></span>
                                </td>
                            </tr>
                        </table>
                    </div>
                </fieldset>
                <fieldset>
                    <div class="fitem">
                        <table width="100%" border="0" cellpadding="0" cellspacing="0">
                            <tr>
                                <td width="20%" align="right">
                                    密码:
                                </td>
                                <td width="30%">
                                    <input id="f_pu_pwd" name="f_pu_pwd" style="width: 150px;" value="" class="yl_inp yw_pwd" />
                                    <span id="f_pu_pwd_tip" class="tip red"></span>
                                </td>
                            </tr>
                        </table>
                    </div>
                </fieldset>


                <fieldset>
                    <div class="fitem">
                        <table width="100%" border="0" cellpadding="0" cellspacing="0">
                            <tr>
                                <td width="20%" align="right">
                                    手机号:
                                </td>
                                <td width="30%">
                                    <input id="f_pu_phone" name="f_pu_phone" style="width: 150px;" value="" class="yl_inp yw_name" />
                                    <span id="f_pu_phone_tip" class="tip red"></span>
                                </td>
                            </tr>
                        </table>
                    </div>
                </fieldset>

                <div class="toolbar" style="text-align: center;">
                    <a class="easyui-linkbutton" data-options="iconCls:'icon-ok'"
                       href="javascript:void(0);" onclick="_submitFm()">绑定</a> <a
                        href="javascript:void(0);" data-options="iconCls:'icon-cancel'"
                        class="easyui-linkbutton"
                        onclick="javascript:parent.$('#dlg').dialog('close')">取消</a>
                </div>
            </form>
        </div>
    </div>
    <!--主体 结束-->
</div>

</body>
</html>

